<?php

namespace App\Modules\Home\Models;


use Illuminate\Database\Eloquent\Model;

/**
 * Class Task 个人健康档案
 * @package App\Modules\Task\Models
 */
class Archives extends Model
{
    protected $table = 'archives';

    protected $fillable = ['id', 'user_id', 'dm_type', 'dm_age', 'complication', 'treatment', 'is_smoke', 'is_drink', 'created_at', 'updated_at', 'status'];

    /**
     * 个人健康档案详情
     * @param $id 任务id
     * @return mixed
     */
    static function getArchives($id)
    {
        return self::where('user_id',$id)->first();
    }

    /**
     * 添加个人健康档案
     * @param $param
     * @return mixed
     */
    static function addArchives($param)
    {
        // TODO check
        return self::create($param);
    }

    /**
     * 更新个人健康档案
     * @param $param
     * @return mixed
     */
    static function updateArchives($param)
    {
        // TODO check
        return self::where('user_id',$param['user_id'])->update($param);
    }
}